package com.example.tallybook.view;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.tallybook.R;
import com.example.tallybook.activity.SysSettingActivity;

public class Home extends AppCompatActivity {
    
    Button bt_sum, bt_newincome, bt_incomedetail, btn_newpay, btn_paydetail, bt_dataanalyse, btn_setting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        
        initView();
        btnOnClick();
    }
    
    private void initView(){
        bt_sum = findViewById(R.id.bt_sum_main);
        bt_newincome = findViewById(R.id.bt_newincome_main);
        bt_incomedetail = findViewById(R.id.bt_incomedetail_main);
        btn_newpay = findViewById(R.id.bt_newpay_main);
        btn_paydetail = findViewById(R.id.bt_paydetail_main);
        bt_dataanalyse = findViewById(R.id.bt_dataanalyse_main);
        btn_setting = findViewById(R.id.bt_syssetting_main);
    }
    
    private void btnOnClick(){
        bt_sum.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(Home.this, SumActivity.class);
                startActivity(intent);//跳转到数据汇总
            }
        });
        bt_newincome.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(Home.this, NewInComeActivity.class);
                startActivity(intent);//跳转到新增收入
            }
        });
        bt_incomedetail.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(Home.this, InComeDetailActivity.class);
                startActivity(intent);//跳转到收入明细
            }
        });
        btn_newpay.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(Home.this, NewPayActivity.class);
                startActivity(intent);//跳转到新增支出
            }
        });
        btn_paydetail.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(Home.this, PayDetailActivity.class);
                startActivity(intent);//跳转到支出明细
            }
        });
        bt_dataanalyse.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(Home.this, DataAnalyseActivity.class);
                startActivity(intent);//跳转到数据分析
            }
        });
        btn_setting.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(Home.this, SysSettingActivity.class);
                startActivity(intent);//跳转到系统设置
            }
        });
    }
}